﻿package view.tips
{
    import __AS3__.vec.*;
    import flash.display.*;
    import morn.core.components.*;
    import morn.core.handlers.*;

    public class RankingTipsGame extends RankingTipsUI
    {
        private var numVec:Vector.<String>;
        private var bg:AutoBitmap;
        private var type:int = 0;
        private var cfg_what:Object;

        public function RankingTipsGame()
        {
            this.numVec = new Vector.<String>;
            this.cfg_what = ConfigDictionary.data.testactive;
            this.numVec.push("一", "二", "三", "四", "五", "六", "七", "八", "九", "十");
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            list_ranks.array = param1.msgArr;
            this.bg.width = param1.msgArr.length * 250;
            list_ranks.renderHandler = new Handler(this.ranksHandler);
            return;
        }// end function

        private function ranksHandler(param1:Component, param2:int) : void
        {
            var _loc_3:Object = null;
            var _loc_4:Label = null;
            var _loc_5:List = null;
            if (param2 < list_ranks.length)
            {
                _loc_3 = list_ranks.array[param2];
                _loc_4 = param1.getChildByName("list_title") as Label;
                _loc_4.text = _loc_3.title;
                _loc_5 = param1.getChildByName("list_ranking") as List;
                _loc_5.array = _loc_3.msg;
                _loc_5.renderHandler = new Handler(this.rankingHandler, [_loc_5]);
            }
            return;
        }// end function

        private function rankingHandler(param1:List, param2:Component, param3:int) : void
        {
            var _loc_4:Object = null;
            var _loc_5:Label = null;
            var _loc_6:Label = null;
            var _loc_7:Label = null;
            var _loc_8:String = null;
            if (param3 < param1.length)
            {
                _loc_4 = param1.array[param3];
                _loc_5 = param2.getChildByName("txt_rank") as Label;
                _loc_5.text = "第" + this.numVec[param3] + "名";
                _loc_6 = param2.getChildByName("txt_name") as Label;
                _loc_6.text = _loc_4.name;
                _loc_7 = param2.getChildByName("txt_level") as Label;
                _loc_7.text = _loc_4.level;
                _loc_8 = "";
                switch(param3)
                {
                    case 0:
                    {
                        _loc_8 = "0xffcc00";
                        break;
                    }
                    case 1:
                    {
                        _loc_8 = "0xb23aee";
                        break;
                    }
                    case 2:
                    {
                        _loc_8 = "0x00b0f0";
                        break;
                    }
                    default:
                    {
                        _loc_8 = "0x00ff00";
                        break;
                        break;
                    }
                }
                var _loc_9:* = _loc_8;
                _loc_5.color = _loc_8;
                var _loc_9:* = _loc_9;
                _loc_6.color = _loc_9;
                _loc_7.color = _loc_9;
            }
            return;
        }// end function

        public function showImage(param1:Bitmap) : void
        {
            this.bg = new AutoBitmap();
            this.bg.bitmapData = param1.bitmapData;
            this.bg.alpha = 0.7;
            this.bg.sizeGrid = [10, 10, 10, 10];
            this.bg.name = "img_bg";
            this.bg.width = 240;
            this.bg.height = 340;
            this.addChildAt(this.bg, 0);
            return;
        }// end function

    }
}
